home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / ARMLINUX / MAIL / 9712 / 000031_owner-linux-arm…r.rutgers.edu _Mon Dec 8 15:42:03 1997.msg < prev    next >
Internet Message Format  |  1998-01-04  |  5KB

  1. Return-Path: <owner-linux-arm-outgoing@vger.rutgers.edu>
  2. Received: from nic.funet.fi (nic.funet.fi [128.214.248.6])
  3.     by odie.barnet.ac.uk (8.8.6/8.8.6) with ESMTP id PAA18223
  4.     for <willy@odie.fluff.org>; Mon, 8 Dec 1997 15:42:01 GMT
  5. Received: from vger.rutgers.edu ([128.6.190.2]:14962 "EHLO vger.rutgers.edu" ident: "root") by nic.funet.fi with ESMTP id <15888-25308>; Mon, 8 Dec 1997 10:01:02 +0200
  6. Received: by vger.rutgers.edu id <971164-2955>; Mon, 8 Dec 1997 02:53:59 -0500
  7. Received: from monarch.ja.net ([128.86.16.37]:42837 "EHLO monarch.ja.net" ident: "NO-IDENT-SERVICE") by vger.rutgers.edu with ESMTP id <971066-2955>; Mon, 8 Dec 1997 02:52:31 -0500
  8. Received: from sun3.nsfnet-relay.ac.uk by monarch.ja.net with SPAM SMTP (PP); Mon, 8 Dec 1997 07:56:39 +0000
  9. Received: from bright.ecs.soton.ac.uk by sun3.nsfnet-relay.ac.uk with NRS SMTP (PP); Mon, 8 Dec 1997 07:56:37 +0000
  10. Received: from  by bright.ecs.soton.ac.uk; Mon, 8 Dec 97 07:54:04 GMT
  11. Received: from raistlin.armlinux.org (raistlin [192.168.0.3]) by caramon.armlinux.org (8.7.4/8.7.3) with ESMTP id UAA08462; Sun, 7 Dec 1997 20:48:24 GMT
  12. From: Russell King <rmk@ecs.soton.ac.uk>
  13. Received: (from rmk@localhost) by raistlin.armlinux.org (8.7.4/8.7.3) id UAA05306; Sun, 7 Dec 1997 20:47:20 GMT
  14. Message-Id: <199712072047.UAA05306@raistlin.armlinux.org>
  15. Subject: Initial test of ELF tools...
  16. To: elf-arm@lists.barnet.ac.uk
  17. Date:     Sun, 7 Dec 1997 20:39:59 +0000 (GMT)
  18. Cc: linux-arm@vger.rutgers.edu
  19. X-Mailer: ELM [version 2.4 PL24]
  20. MIME-Version: 1.0
  21. Content-Type: text/plain; charset="US-ASCII"
  22. X-Orcpt: rfc822;linux-arm@vger.rutgers.edu
  23. X-Envid: [/PRMD=UK.AC/ADMD= /C=GB/;<199712072047.UAA05306@raistlin.]
  24. Sender: owner-linux-arm@vger.rutgers.edu
  25. Precedence: bulk
  26. Status: RO
  27.  
  28. Hi all!
  29.  
  30. I decided to try out my hacks of gcc-2.7.2.2 and binutils-2.8 on the Linux kernel
  31. (v2.1.71) to see what it would make of it...  However, gcc requires modifications
  32. far beyond the simple backend mods to get it to produce code suitable for compiling
  33. up the kernel with the __initfunc extensions...
  34.  
  35. The problem is this:
  36.     The Linux kernel puts all functions and data relating to initialisation
  37.     in a separate section - .text.init and .data.init.  This allows the Linux
  38.     kernel to drop it's initialisation code after boot (since it's only
  39.     run once, there's no point in keeping it in memory).
  40.  
  41.     When GCC compiles this code under ARM, using the following pre-processed
  42.     C code (somewhat cut-down):
  43.         void calibrate_delay(void) __attribute__((__section__(".text.init")));
  44.         void calibrate_delay(void)
  45.         {
  46.             loops_per_sec = (1<<12);
  47.  
  48.             printk("Calibrating delay loop.. ");
  49.             ...
  50.         }
  51.     GCC outputs the following assembler code (cut-down):
  52.                 .global loops_per_sec
  53.         .data
  54.                 .align  0
  55.                 .type    loops_per_sec,#object
  56.                 .size    loops_per_sec,4
  57.         loops_per_sec:
  58.                 .word   4096
  59.         .text
  60.         .LC106:
  61.                 .ascii  "Calibrating delay loop.. \000"
  62.         .section        .text.init,"ax",@progbits
  63.                 .align  0
  64.         .LC105:
  65.                 .word   loops_per_sec
  66.                 .align  0
  67.                 .global calibrate_delay
  68.                 .type    calibrate_delay,#function
  69.         calibrate_delay:
  70.                 @ args = 0, pretend = 0, frame = 0
  71.                 @ frame_needed = 1, current_function_anonymous_args = 0
  72.                 @ pic_reg_used = 0
  73.                 mov     ip, sp
  74.                 stmfd   sp!, {r4, r5, r6, r7, r8, fp, ip, lr, pc}
  75.             ...
  76.                 sub     r0, pc, #(8 + . -.LC106)
  77.                 sub     fp, ip, #4
  78.                 bl      printk
  79.  
  80.     Unfortunately, the simple code generated for the printk doesn't work -
  81.     the value of (8+.-.LC106) is not known becuase the location of .LC106
  82.     is not in the current section, and the text strings are written to the
  83.     file *before* the constant pool (I've moved the section selection as
  84.     early as I can with the current way GCC works).
  85.  
  86.     As far as I can see, we have the following options:
  87.     a) Add an entry into the constant pool, but this will require an extra
  88.        load, and an extra 4 bytes in the constant pool.
  89.     b) Output the strings into the same section as the function (this
  90.        would be the best solution, but it may not be easy to do with
  91.        gcc).
  92.     c) Add relocations for sub instructions etc, and get the binutils
  93.        to do relaxing (requires a lot of work).
  94.  
  95. If anyone would like to have a go at GCC, my replacement config/arm directory
  96. will be available next weekend.  (Sorry, can't upload it this weekend - someone's
  97. successfully launched a denial of service attack against the FTP server).  I'd
  98. like to be able (at some point) to make use of this feature that the Linux kernel
  99. offers.
  100.    _____
  101.   |_____| ------------------------------------------------- ---+---+-
  102.   |   |         Russell King        rmk@ecs.soton.ac.uk       --- ---
  103.   | | | |     http://www.arm.uk.linux.org/~rmk/home.html     /  /  |
  104.   | +-+-+                                                     --- -+-
  105.   /   |               THE developer of ARM Linux              |+| /|\
  106.  /  | | |                                                     ---  |
  107.     +-+-+ -------------------------------------------------  /\\\  |
  108. unsubscribe: body of `unsubscribe linux-arm' to majordomo@vger.rutgers.edu